#include <sys/syscall.h>
#include <mips/regdef.h>

        .text
        .globl  main


main:
    subu    sp,sp,24
	sw	$fp,20(sp)
	sw	gp,16(sp)
	move	$fp,sp
    move    t1,zero
    sw      t1,12($fp)

while:  la      a0, pnum
        li      v0, 4
        syscall
        li      v0,5
        syscall
        sw      v0,8($fp)
        lw      t0,8($fp)
        lw      t1,12($fp)
        addu    t1,t1,t0
        sw      t1,12($fp)
        lw      t0,8($fp)
        bnez    t0,while

        li      v0,4
        la      a0,msge
        syscall

        li      v0,1
        lw      a0,12($fp)
        syscall

	move	sp,$fp
	lw	$fp,20(sp)
	addu	sp,sp,24
	j	ra

        .rdata

pnum:   .asciiz "Ingrese un entero (0 termina): \n"
msge:   .asciiz "Resultado acumulado: "
